package com.jasonchoi.security.commons.utils;

import cn.hutool.crypto.SecureUtil;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @Author: JasonChoi
 * @Date: 2020/1/3 14:16
 */
public class MyMD5PasswordEncode implements PasswordEncoder {
    @Override
    public String encode(CharSequence charSequence) {
        return SecureUtil.md5(charSequence.toString());
    }

    @Override
    public boolean matches(CharSequence charSequence, String encodedCharSequence) {
        return encodedCharSequence.equals(SecureUtil.md5(charSequence.toString()));
    }
}
